$("#form_hotel input[type=text], #form_hotel select").removeClass("field-with-errors")
$("#form_hotel .error-message").html("").removeClass("red")

<% if remotipart_submitted? %>
  $('#admin_title').html('Manage Hotels');
  $('#admin_content').html("<%= j render partial: 'hotels/hotel_created' %>")
<% else %>
  <% if @hotel.errors.any? %>
    <% flash[:alert] = ' Something missing, Please check again!' %>
    $("#flash_message_wrapper").html("<%=j render partial: 'layouts/flash_messages' %>"); 
    $('#prerequisites').collapse('toggle');
    <% @hotel.errors.each do | field, message| %>
      $("#<%=j field.to_s %>_error").html("<%=j message %>").addClass("red");
    <% end %>
  <% else %>
    $('#admin_title').html("<%= j 'Manage Hotels' %>");
    $('#filter_admin').show();
    $('#admin_content').html("<%= j render partial: 'hotels/index', locals: { :hotels => @hotels } %>")
    $('#filter_admin').html("<%= j render partial: 'hotels/filter_hotels', locals: { :hotels => @hotels } %>");
    $("#flash_message_wrapper").html("<%= j render partial: 'layouts/flash_messages' %>");
    <% flash[:notice] = ' Hotel Room Type successfully created' %>
  <% end %>
<% end %>
